﻿@model LanguageSelectorModel
@using Nop.Web.Models.Common;
@if (Model.AvailableLanguages.Count > 1)
{
    if (Model.UseImages)
    {
    <ul class="language-list">
        @foreach (var lang in Model.AvailableLanguages)
        {
            <li><a href="@Url.RouteUrl("ChangeLanguage", new { langid = lang.Id })" title="@lang.Name">
                <img title='@lang.Name' alt='@lang.Name' @(lang.Id == Model.CurrentLanguage.Id ? " class=selected" : null)
                 src="@Url.Content("~/Content/Images/flags/" + @lang.FlagImageFileName) " />
            </a></li>
        }
    </ul>
    }
    else
    {
        var languages = Model.AvailableLanguages.Select(x => new SelectListItem
        {
            Text = x.Name,
            Value = @Url.RouteUrl("ChangeLanguage", new { langid = x.Id }),
            Selected = x.Id.Equals(Model.CurrentLanguage.Id)
        });
    
    @Html.DropDownList("customerlanguage", languages, new { onchange = "setLocation(this.value);" })
    }
}